package com.action.ui.activity.user;

import android.support.v4.app.Fragment;

import com.action.entity.event.SwitchAssetEvent;
import com.action.ui.activity.BaseFragementActivity;
import com.action.ui.fragment.AssetFragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.base.app_core.util.AppConstants;
import com.hwangjr.rxbus.RxBus;
import com.hwangjr.rxbus.annotation.Subscribe;
import com.hwangjr.rxbus.thread.EventThread;

@Route(path = AppConstants.ROUTEURI.USERASSETS)
public class AssetActivity extends BaseFragementActivity {
    AssetFragment assetFragment = null;


    @Override
    protected Fragment getMyFragement() {
        if (assetFragment == null)
            assetFragment = new AssetFragment();
        return assetFragment;
    }

    @Subscribe(thread = EventThread.MAIN_THREAD)
    public void consumeSwitchAssetEvent(SwitchAssetEvent switchAssetEvent) {
        assetFragment = null;
        AssetActivity.this.finish();
    }

    @Override
    protected void initView() {
        super.initView();
        setToolBar("我的资产");
        RxBus.get().register(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RxBus.get().unregister(this);
    }
}
